

import 'package:floor/floor.dart';

import '../entity/ProductAttrBean.dart';

@dao
abstract class ProductAttrDao {

  @Query('DELETE FROM ProductAttrBean')
  Future<void> deleteAll();

  @delete
  Future<int> deleteList(List<ProductAttrBean> beanList);

  @delete
  Future<void> deleteOne(ProductAttrBean bean);

  @Query('SELECT * FROM ProductAttrBean')
  Future<List<ProductAttrBean>> findAll();

  @Query('SELECT * FROM ProductAttrBean WHERE productCode = :productCode')
  Future<List<ProductAttrBean>> findByProductCode(String productCode);

  @Query('SELECT * FROM ProductAttrBean WHERE productId = :productId')
  Future<List<ProductAttrBean>> findByProductId(int productId);

  @Query('SELECT * FROM ProductAttrBean WHERE id = :id')
  Future<ProductAttrBean?> findById(int id);

  @insert
  Future<void> insertOne(ProductAttrBean person);

  @insert
  Future<void> insertList(List<ProductAttrBean> personList);
}